<template>
  <div class="charts" ref="chartsss" style="width: 800px; height: 500px"></div>
</template>

<script>
import * as echarts from 'echarts'
import axios from 'axios'

export default {
  name: 'index',

//  页面初始化完成操作dom节点
  mounted() {

    axios.get('http://localhost:8081/product/pieVOList').then((res) => {
      console.log(res)
      console.log(res.data)
      let chartsType = echarts.init(this.$refs.chartsss)
      chartsType.setOption({
        title: {
          text: 'Referer of a Website',
          subtext: 'Fake Data',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: res.data,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      })

    })

  }

}
</script>

<style scoped>

</style>
